<template>
<div class="detail">
    <detail-header></detail-header>
    <detail-swiper :swiperList='swiperList'></detail-swiper>
    <router-view :imgList='imgList' :galaryList='galaryList' :addressList='addressList'></router-view>
    <detail-map></detail-map>

</div>
</template>
</div>
</template>

<script>
//	引入组件
import detailHeader from './components/detailHeader'
import detailSwiper from './components/detailSwiper'
import detailMap from './components/detailMap'
import axios from 'axios'
//	定义输出组件name
export default {
    name: 'Detail',
    //注册组件
    components: {
        detailHeader,
        detailSwiper,
        detailMap,

    },
    data() {
        return {
            imgList: [],
            galaryList: [],
            swiperList: [],
            addressList: [],

        }
    },
    methods: {
        getDetailData() {
            axios.get("/api/detail.json?id=" + this.$route.params.id)
                .then(this.getDetailDataSucc)
        },
        getDetailDataSucc(res) {
            // console.log(res)
            res = res.data
            if (res.data) {
                const data = res.data
                this.addressList = data.addressList
                this.galaryList = data.galaryList
                this.imgList = data.imgList
                this.swiperList = data.swiperList
                // this.$store.state.galaryList=this.galaryList
            }
        },
        // a(){
        // this.$store.state.galaryList.push(this.galaryList)
        // }

    },

    mounted() {
        this.getDetailData()

    }

}
</script>

<style scoped>

</style>
